package irv3

import "github.com/astaxie/beego/orm"

type Device struct {
	Id      int    `orm:"Column(id)"`
	Name    string `orm:"Column(_name)"`
	MacAddr string `orm:"Column(mac_address)"`
	IPaddr  string `orm:"Column(ip_address)"`
}

func (u *Device) TableName() string {
	return DeviceTBName()
}

func FindAllDevice() (*[]Device, error) {
	o := orm.NewOrm()
	o.Using("irv3")
	qs := o.QueryTable(DeviceTBName())
	devices := new([]Device)
	_, err := qs.All(devices)
	return devices, err
}
